//### This file created by BYACC 1.8(/Java extension  1.15)
//### Java capabilities added 7 Jan 97, Bob Jamison
//### Updated : 27 Nov 97  -- Bob Jamison, Joe Nieten
//###           01 Jan 98  -- Bob Jamison -- fixed generic semantic constructor
//###           01 Jun 99  -- Bob Jamison -- added Runnable support
//###           06 Aug 00  -- Bob Jamison -- made state variables class-global
//###           03 Jan 01  -- Bob Jamison -- improved flags, tracing
//###           16 May 01  -- Bob Jamison -- added custom stack sizing
//###           04 Mar 02  -- Yuval Oren  -- improved java performance, added options
//###           14 Mar 02  -- Tomas Hurka -- -d support, static initializer workaround
//### Please send bug reports to tom@hukatronic.cz
//### static char yysccsid[] = "@(#)yaccpar	1.8 (Berkeley) 01/20/90";






//#line 2 "cvbpl.y"
  import java.io.*;
	import java.util.HashMap;
	import java.util.*;
//#line 21 "Parser.java"




public class Parser
{

boolean yydebug;        //do I want debug output?
int yynerrs;            //number of errors so far
int yyerrflag;          //was there an error?
int yychar;             //the current working character

//########## MESSAGES ##########
//###############################################################
// method: debug
//###############################################################
void debug(String msg)
{
  if (yydebug)
    System.out.println(msg);
}

//########## STATE STACK ##########
final static int YYSTACKSIZE = 500;  //maximum stack size
int statestk[] = new int[YYSTACKSIZE]; //state stack
int stateptr;
int stateptrmax;                     //highest index of stackptr
int statemax;                        //state when highest index reached
//###############################################################
// methods: state stack push,pop,drop,peek
//###############################################################
final void state_push(int state)
{
  try {
		stateptr++;
		statestk[stateptr]=state;
	 }
	 catch (ArrayIndexOutOfBoundsException e) {
     int oldsize = statestk.length;
     int newsize = oldsize * 2;
     int[] newstack = new int[newsize];
     System.arraycopy(statestk,0,newstack,0,oldsize);
     statestk = newstack;
     statestk[stateptr]=state;
  }
}
final int state_pop()
{
  return statestk[stateptr--];
}
final void state_drop(int cnt)
{
  stateptr -= cnt; 
}
final int state_peek(int relative)
{
  return statestk[stateptr-relative];
}
//###############################################################
// method: init_stacks : allocate and prepare stacks
//###############################################################
final boolean init_stacks()
{
  stateptr = -1;
  val_init();
  return true;
}
//###############################################################
// method: dump_stacks : show n levels of the stacks
//###############################################################
void dump_stacks(int count)
{
int i;
  System.out.println("=index==state====value=     s:"+stateptr+"  v:"+valptr);
  for (i=0;i<count;i++)
    System.out.println(" "+i+"    "+statestk[i]+"      "+valstk[i]);
  System.out.println("======================");
}


//########## SEMANTIC VALUES ##########
//public class ParserVal is defined in ParserVal.java


String   yytext;//user variable to return contextual strings
ParserVal yyval; //used to return semantic vals from action routines
ParserVal yylval;//the 'lval' (result) I got from yylex()
ParserVal valstk[];
int valptr;
//###############################################################
// methods: value stack push,pop,drop,peek.
//###############################################################
void val_init()
{
  valstk=new ParserVal[YYSTACKSIZE];
  yyval=new ParserVal();
  yylval=new ParserVal();
  valptr=-1;
}
void val_push(ParserVal val)
{
  if (valptr>=YYSTACKSIZE)
    return;
  valstk[++valptr]=val;
}
ParserVal val_pop()
{
  if (valptr<0)
    return new ParserVal();
  return valstk[valptr--];
}
void val_drop(int cnt)
{
int ptr;
  ptr=valptr-cnt;
  if (ptr<0)
    return;
  valptr = ptr;
}
ParserVal val_peek(int relative)
{
int ptr;
  ptr=valptr-relative;
  if (ptr<0)
    return new ParserVal();
  return valstk[ptr];
}
final ParserVal dup_yyval(ParserVal val)
{
  ParserVal dup = new ParserVal();
  dup.ival = val.ival;
  dup.dval = val.dval;
  dup.sval = val.sval;
  dup.obj = val.obj;
  return dup;
}
//#### end semantic value section ####
public final static short NL=257;
public final static short FUNCSYM=258;
public final static short PROGSYM=259;
public final static short IDENT=260;
public final static short INT=261;
public final static short FLOAT=262;
public final static short TYPE_VOID=263;
public final static short TYPE_HISTOGRAM=264;
public final static short TYPE_MATRIX=265;
public final static short TYPE_IMAGE=266;
public final static short TYPE_STRING=267;
public final static short TYPE_HANDLE=268;
public final static short TYPE_INT=269;
public final static short TYPE_FLOAT=270;
public final static short ISNE=271;
public final static short ISEQ=272;
public final static short LT=273;
public final static short GT=274;
public final static short LE=275;
public final static short GE=276;
public final static short PLUS=277;
public final static short MULT=278;
public final static short DIV=279;
public final static short MINUS=280;
public final static short CONV=281;
public final static short SHL=282;
public final static short SHR=283;
public final static short ASSIGN=284;
public final static short IF=285;
public final static short ELSE=286;
public final static short WHILE=287;
public final static short FOR=288;
public final static short BREAK=289;
public final static short CONTINUE=290;
public final static short RETURN=291;
public final static short CSTRING=292;
public final static short NEG=293;
public final static short YYERRCODE=256;
final static short yylhs[] = {                           -1,
    0,    0,    3,    3,    3,    3,    3,    5,    5,    5,
    5,    5,    5,    5,    5,    6,    6,    8,    8,    8,
    9,    9,    9,    9,   10,   10,   10,   11,   11,   11,
   11,   11,   12,   12,   12,   13,   13,   13,    4,    4,
    7,    7,   14,   16,   16,   17,   17,   17,   17,   19,
   19,   18,   18,   15,   15,   15,   15,   15,   15,   15,
   15,   20,   20,   21,   21,   22,   22,   23,   24,   24,
   25,   25,   25,   25,   25,   26,   26,   27,   27,   31,
   31,   31,   31,   28,   32,   32,   29,   29,   33,   33,
   34,   34,   35,   30,   30,   30,   30,    1,   36,   36,
    2,   37,   38,   38,   39,   39,   40,
};
final static short yylen[] = {                            2,
    2,    1,    1,    3,    1,    1,    1,    1,    4,    6,
    2,    4,    3,    3,   10,    1,    3,    1,    2,    2,
    1,    3,    3,    3,    1,    3,    3,    1,    3,    3,
    3,    3,    1,    3,    3,    1,    3,    3,    1,    3,
    1,    0,    3,    1,    3,    1,    4,    3,    3,    1,
    3,    1,    3,    1,    1,    1,    1,    1,    1,    1,
    1,    1,    1,    3,    3,    1,    3,    3,    1,    3,
    1,    1,    1,    1,    1,    2,    1,    3,    2,    1,
    1,    2,    2,    6,    2,    0,    7,   11,    1,    3,
    1,    3,    3,    2,    2,    2,    3,    4,    1,    2,
    2,    3,    4,    3,    1,    3,    2,
};
final static short yydefred[] = {                         0,
    0,    0,    0,    0,    2,    0,    0,  101,    1,   61,
   58,   56,   57,   59,   60,   54,   55,    0,    0,   99,
    3,    7,    6,    0,    0,    0,    0,    0,    0,    5,
    0,    0,    0,   77,   79,    8,    0,    0,    0,    0,
    0,    0,    0,    0,   80,    0,   81,   71,   72,   73,
   74,   75,    0,    0,    0,   98,  100,    0,    0,    0,
   94,   95,   96,    0,   19,    0,   20,   76,    0,    0,
   11,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,   52,    0,    0,   44,
    0,   78,   83,   82,    0,  102,    0,    0,   89,    0,
   97,    4,   13,    0,    0,    0,    0,   14,   40,   22,
   23,   24,   21,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   43,    0,    0,  104,    0,
    0,  105,    0,    0,    0,    0,   12,    0,    0,    9,
    0,   53,   45,    0,    0,   62,   49,   63,   48,   50,
    0,  107,  103,    0,    0,    0,    0,   90,   17,   41,
    0,    0,    0,    0,    0,   66,   47,    0,  106,    0,
   84,    0,    0,    0,   10,   64,   69,    0,    0,   65,
   51,   85,   87,    0,    0,   91,    0,    0,   68,   67,
    0,    0,    0,    0,   70,   93,    0,   92,    0,    0,
   15,   88,
};
final static short yydgoto[] = {                          3,
    4,    5,   36,   37,   38,  105,  106,   39,   40,   41,
   42,   43,   44,   45,   18,   89,   90,   91,  151,  147,
  148,  165,  166,  178,   47,   48,   49,   50,   51,   52,
   53,  171,  100,  185,  186,   19,   20,   55,  131,  132,
};
final static short yysindex[] = {                      -250,
 -106,  -94,    0, -216,    0,  150,  -33,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0, -208,  -65,    0,
    0,    0,    0,   14,   18,   28,   15,   17,   26,    0,
   69,   69,   69,    0,    0,    0,   21,  -27, -201, -239,
 -255, -241, -244, -196,    0,  -38,    0,    0,    0,    0,
    0,    0,  -22,   59,  -94,    0,    0,   69,   69, -147,
    0,    0,    0,   61,    0,   76,    0,    0,   32,   69,
    0, -142,   69,   69,   69,   69,   69,   69,   69,   69,
   69,   69,   69,   69,   69,   69,    0,  -38,  -29,    0,
  -35,    0,    0,    0,  117,    0,   82,   87,    0,    4,
    0,    0,    0,    0,    5,   75,  -30,    0,    0,    0,
    0,    0,    0, -239, -239, -255, -255, -255, -255, -241,
 -241, -244, -244,   99,  -38,    0,   55,   65,    0, -114,
    9,    0,   22,   24,   88, -109,    0,   69,   69,    0,
   69,    0,    0,   55,   31,    0,    0,    0,    0,    0,
   34,    0,    0,  150, -131,   22,   66,    0,    0,    0,
  115,   68,  121,   69,  -41,    0,    0,   69,    0,   22,
    0,   45,   69,   69,    0,    0,    0,  -34,   31,    0,
    0,    0,    0,  113,  -24,    0,  116,   69,    0,    0,
   69,   50,   69,   69,    0,    0,   22,    0,  134,   52,
    0,    0,
};
final static short yyrindex[] = {                         0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,   91,   63,  128,
  368,  431,   38,   83,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  123,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  -28,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  -20,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  335,  348,  381,  394,  407,  423,  436,
  444,   67,   71,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  135,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   11,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  123,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  141,    0,    0,    0,    0,    0,    0,
    0,    0,
};
final static short yygindex[] = {                         0,
    0,  179,    0,  672,    0,    0, -133,  497,   16,   86,
   54,   58,    0,  132,   -6,    0,   64,  102,    0,    0,
   47,    0,   27,    0,  -17,    0,    2,    0,    0,    0,
    0,    0,    0,    0,    1,    0,  174,    0,    0,   41,
};
final static int YYTABLESIZE=866;
static short yytable[];
static { yytable();}
static void yytable(){
yytable = new short[]{                         33,
   46,   88,  179,    8,  128,  161,   32,    1,    2,  188,
   33,   31,   69,  141,  125,   46,    6,   32,   72,  193,
   16,   77,   31,   16,   78,   34,   83,   84,    7,  126,
   46,   79,   80,   81,   82,   94,   34,   41,   74,   75,
  187,   76,    2,   86,  135,  137,   46,  136,  138,  153,
   86,   54,  154,   58,   33,   86,   96,   59,   33,   56,
  199,   32,  140,   70,   33,   32,   31,   60,  192,   86,
   31,   32,  103,   61,  167,   62,   31,  168,   36,   68,
   34,   36,   73,  180,   63,   85,   86,   33,  130,    7,
  189,   35,  114,  115,  144,   36,   36,   33,   95,   31,
    7,   33,   92,   21,   32,  149,   21,   37,   32,   31,
   37,   38,   99,   31,   38,  155,  102,  108,   71,  101,
   21,   21,  133,   39,   37,   37,   39,  134,   38,   38,
   36,   18,  139,   86,   18,   86,  120,  121,  172,  142,
   39,   39,  122,  123,    7,  152,  156,  130,   18,   18,
  158,  157,  182,  164,  170,   21,  173,  129,  174,   37,
  175,  176,   36,   38,  116,  117,  118,  119,   25,  183,
  191,   25,  197,  194,  201,   39,  202,  145,   42,  200,
   42,   42,    9,   18,   93,   25,   25,   21,  143,  124,
  163,   37,   57,  198,  169,   38,    0,   10,   11,   12,
   13,   14,   15,   16,   17,  190,    0,   39,    0,    0,
    0,    0,    0,    0,    0,   18,    0,    0,    0,    0,
   25,   87,    0,    0,    0,    0,   21,   22,   23,   10,
   11,   12,   13,   14,   15,   16,   17,   21,   22,   23,
   10,   11,   12,   13,   14,   15,   16,   17,  127,    0,
    0,   24,   25,   25,   26,   27,   28,   29,   30,    0,
    0,    0,   24,    0,   25,   26,   27,   28,   29,   30,
   86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
   86,   21,   22,   23,    0,   21,   22,   23,    0,    0,
    0,   21,   22,   23,    0,   86,    0,   86,   86,   86,
   86,   86,   86,    0,    0,    0,   24,    0,   25,   26,
   27,   28,   29,   30,   21,   22,   23,   30,    0,   36,
   36,    0,    0,   30,   21,   22,   23,    0,   21,   22,
   23,    0,    0,   21,   21,   21,   21,   21,   21,   21,
   21,   21,   21,   21,   21,   21,   30,    0,   37,   37,
    0,    0,   38,   38,    0,    0,   30,    0,    0,    0,
   30,   18,   18,   18,   18,   18,   18,   18,   18,   18,
   18,   18,   18,   18,   18,   26,    0,    0,   26,   10,
   11,   12,   13,   14,   15,   16,   17,    0,   27,    0,
    0,   27,   26,   26,    0,    0,    0,    0,   25,   25,
   25,   25,   25,   25,   25,   27,   27,   25,   28,   25,
   25,   28,   10,   11,   12,   13,   14,   15,   16,   17,
    0,   29,    0,    0,   29,   28,   28,   26,    0,    0,
    0,    0,    0,    0,   30,    0,    0,   30,   29,   29,
   27,    0,    0,    0,    0,    0,    0,   31,    0,    0,
   31,   30,   30,    0,    0,    0,    0,    0,    0,   26,
   28,    0,    0,   32,   31,   31,   32,    0,    0,    0,
    0,   33,   27,   29,   33,    0,   35,    0,    0,   35,
   32,   32,    0,    0,   34,    0,   30,   34,   33,   33,
    0,    0,   28,   35,   35,    0,    0,    0,    0,   31,
    0,   34,   34,    0,    0,   29,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   32,    0,    0,   30,    0,
    0,    0,    0,   33,    0,    0,    0,   65,   35,   67,
    0,   31,    0,    0,    0,    0,   34,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,   32,    0,    0,
    0,    0,    0,    0,    0,   33,    0,    0,    0,    0,
   35,    0,    0,    0,    0,    0,    0,    0,   34,    0,
  110,  111,  112,  113,  113,  113,  113,  113,  113,  113,
  113,  113,  113,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   26,   26,   26,   26,   26,
   26,   26,    0,    0,   26,    0,   26,   26,   27,   27,
   27,   27,   27,   27,   27,    0,    0,   27,    0,   27,
   27,    0,    0,    0,    0,    0,    0,    0,   28,   28,
   28,   28,   28,   28,    0,    0,    0,    0,    0,   28,
   28,   29,   29,   29,   29,   29,   29,    0,    0,    0,
    0,    0,   29,   29,   30,   30,   30,   30,   30,   30,
    0,    0,    0,    0,    0,   30,   30,   31,   31,   31,
   31,   31,   31,    0,    0,    0,    0,    0,   31,   31,
    0,    0,    0,   32,   32,   32,   32,   32,   32,    0,
   64,   33,   33,   66,   32,   32,   35,   35,    0,    0,
    0,    0,   33,   33,   34,   34,    0,   35,   35,    0,
    0,    0,    0,    0,    0,   34,   34,    0,    0,   97,
   98,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  104,  107,    0,    0,  109,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  146,  150,
    0,    0,    0,    0,    0,    0,    0,    0,    0,  159,
  160,    0,  162,    0,    0,   66,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  177,    0,    0,    0,  181,
    0,    0,    0,    0,  184,  160,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,  195,
    0,    0,  196,    0,  184,  160,
};
}
static short yycheck[];
static { yycheck(); }
static void yycheck() {
yycheck = new short[] {                         33,
    7,   40,   44,    2,   40,  139,   40,  258,  259,   44,
   33,   45,   40,   44,   44,   44,  123,   40,   46,   44,
   41,  277,   45,   44,  280,   59,  271,  272,  123,   59,
   59,  273,  274,  275,  276,   53,   59,   58,  278,  279,
  174,  281,  259,   33,   41,   41,   53,   44,   44,   41,
   40,  260,   44,   40,   33,   45,   55,   40,   33,  125,
  194,   40,   93,   91,   33,   40,   45,   40,   93,   59,
   45,   40,   41,   59,   41,   59,   45,   44,   41,   59,
   59,   44,  284,  125,   59,  282,  283,   33,   95,  123,
  125,  125,   77,   78,   40,   58,   59,   33,   40,   45,
  123,   33,  125,   41,   40,   41,   44,   41,   40,   45,
   44,   41,  260,   45,   44,  133,   41,  260,  146,   59,
   58,   59,   41,   41,   58,   59,   44,   41,   58,   59,
   93,   41,   58,  123,   44,  125,   83,   84,  156,   41,
   58,   59,   85,   86,  123,  260,  123,  154,   58,   59,
  260,   64,  170,  123,  286,   93,   91,   41,   44,   93,
   93,   41,  125,   93,   79,   80,   81,   82,   41,  125,
   58,   44,  123,   58,   41,   93,  125,  123,   44,  197,
   58,   41,    4,   93,   53,   58,   59,  125,  125,   88,
  144,  125,   19,  193,  154,  125,   -1,  263,  264,  265,
  266,  267,  268,  269,  270,  179,   -1,  125,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,   -1,   -1,
   93,  260,   -1,   -1,   -1,   -1,  260,  261,  262,  263,
  264,  265,  266,  267,  268,  269,  270,  260,  261,  262,
  263,  264,  265,  266,  267,  268,  269,  270,  284,   -1,
   -1,  285,  125,  287,  288,  289,  290,  291,  292,   -1,
   -1,   -1,  285,   -1,  287,  288,  289,  290,  291,  292,
  260,  261,  262,  263,  264,  265,  266,  267,  268,  269,
  270,  260,  261,  262,   -1,  260,  261,  262,   -1,   -1,
   -1,  260,  261,  262,   -1,  285,   -1,  287,  288,  289,
  290,  291,  292,   -1,   -1,   -1,  285,   -1,  287,  288,
  289,  290,  291,  292,  260,  261,  262,  292,   -1,  282,
  283,   -1,   -1,  292,  260,  261,  262,   -1,  260,  261,
  262,   -1,   -1,  271,  272,  273,  274,  275,  276,  277,
  278,  279,  280,  281,  282,  283,  292,   -1,  282,  283,
   -1,   -1,  282,  283,   -1,   -1,  292,   -1,   -1,   -1,
  292,  271,  272,  273,  274,  275,  276,  277,  278,  279,
  280,  281,  282,  283,  284,   41,   -1,   -1,   44,  263,
  264,  265,  266,  267,  268,  269,  270,   -1,   41,   -1,
   -1,   44,   58,   59,   -1,   -1,   -1,   -1,  271,  272,
  273,  274,  275,  276,  277,   58,   59,  280,   41,  282,
  283,   44,  263,  264,  265,  266,  267,  268,  269,  270,
   -1,   41,   -1,   -1,   44,   58,   59,   93,   -1,   -1,
   -1,   -1,   -1,   -1,   41,   -1,   -1,   44,   58,   59,
   93,   -1,   -1,   -1,   -1,   -1,   -1,   41,   -1,   -1,
   44,   58,   59,   -1,   -1,   -1,   -1,   -1,   -1,  125,
   93,   -1,   -1,   41,   58,   59,   44,   -1,   -1,   -1,
   -1,   41,  125,   93,   44,   -1,   41,   -1,   -1,   44,
   58,   59,   -1,   -1,   41,   -1,   93,   44,   58,   59,
   -1,   -1,  125,   58,   59,   -1,   -1,   -1,   -1,   93,
   -1,   58,   59,   -1,   -1,  125,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   93,   -1,   -1,  125,   -1,
   -1,   -1,   -1,   93,   -1,   -1,   -1,   31,   93,   33,
   -1,  125,   -1,   -1,   -1,   -1,   93,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  125,   -1,   -1,   -1,   -1,
  125,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  125,   -1,
   74,   75,   76,   77,   78,   79,   80,   81,   82,   83,
   84,   85,   86,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  271,  272,  273,  274,  275,
  276,  277,   -1,   -1,  280,   -1,  282,  283,  271,  272,
  273,  274,  275,  276,  277,   -1,   -1,  280,   -1,  282,
  283,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  271,  272,
  273,  274,  275,  276,   -1,   -1,   -1,   -1,   -1,  282,
  283,  271,  272,  273,  274,  275,  276,   -1,   -1,   -1,
   -1,   -1,  282,  283,  271,  272,  273,  274,  275,  276,
   -1,   -1,   -1,   -1,   -1,  282,  283,  271,  272,  273,
  274,  275,  276,   -1,   -1,   -1,   -1,   -1,  282,  283,
   -1,   -1,   -1,  271,  272,  273,  274,  275,  276,   -1,
   29,  271,  272,   32,  282,  283,  271,  272,   -1,   -1,
   -1,   -1,  282,  283,  271,  272,   -1,  282,  283,   -1,
   -1,   -1,   -1,   -1,   -1,  282,  283,   -1,   -1,   58,
   59,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   69,   70,   -1,   -1,   73,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  127,  128,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  138,
  139,   -1,  141,   -1,   -1,  144,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,  164,   -1,   -1,   -1,  168,
   -1,   -1,   -1,   -1,  173,  174,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  188,
   -1,   -1,  191,   -1,  193,  194,
};
}
final static short YYFINAL=3;
final static short YYMAXTOKEN=293;
final static String yyname[] = {
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,"'!'",null,null,null,null,null,null,"'('","')'","'*'","'+'",
"','","'-'","'.'","'/'",null,null,null,null,null,null,null,null,null,null,"':'",
"';'",null,null,null,null,"'@'",null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,"'['",null,"']'","'^'",null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,"'{'",null,"'}'",null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,"'\\222'",null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,"NL","FUNCSYM","PROGSYM",
"IDENT","INT","FLOAT","TYPE_VOID","TYPE_HISTOGRAM","TYPE_MATRIX","TYPE_IMAGE",
"TYPE_STRING","TYPE_HANDLE","TYPE_INT","TYPE_FLOAT","ISNE","ISEQ","LT","GT",
"LE","GE","PLUS","MULT","DIV","MINUS","CONV","SHL","SHR","ASSIGN","IF","ELSE",
"WHILE","FOR","BREAK","CONTINUE","RETURN","CSTRING","NEG",
};
final static String yyrule[] = {
"$accept : translation_unit",
"translation_unit : func_block prog_block",
"translation_unit : prog_block",
"primary_expression : IDENT",
"primary_expression : '(' assignment_expression ')'",
"primary_expression : CSTRING",
"primary_expression : FLOAT",
"primary_expression : INT",
"postfix_expression : primary_expression",
"postfix_expression : postfix_expression '[' assignment_expression ']'",
"postfix_expression : postfix_expression '[' assignment_expression ',' assignment_expression ']'",
"postfix_expression : postfix_expression '\\222'",
"postfix_expression : postfix_expression '(' argument_expression_list ')'",
"postfix_expression : postfix_expression '(' ')'",
"postfix_expression : postfix_expression '.' IDENT",
"postfix_expression : postfix_expression '(' assignment_expression_opt ':' assignment_expression_opt ',' assignment_expression_opt ':' assignment_expression_opt ')'",
"argument_expression_list : assignment_expression",
"argument_expression_list : argument_expression_list ',' assignment_expression",
"unary_expression : postfix_expression",
"unary_expression : '-' unary_expression",
"unary_expression : '!' unary_expression",
"multiplicative_expression : unary_expression",
"multiplicative_expression : multiplicative_expression MULT unary_expression",
"multiplicative_expression : multiplicative_expression DIV unary_expression",
"multiplicative_expression : multiplicative_expression CONV unary_expression",
"additive_expression : multiplicative_expression",
"additive_expression : additive_expression PLUS multiplicative_expression",
"additive_expression : additive_expression MINUS multiplicative_expression",
"relational_expression : additive_expression",
"relational_expression : relational_expression LT additive_expression",
"relational_expression : relational_expression GT additive_expression",
"relational_expression : relational_expression LE additive_expression",
"relational_expression : relational_expression GE additive_expression",
"equality_expression : relational_expression",
"equality_expression : equality_expression ISEQ relational_expression",
"equality_expression : equality_expression ISNE relational_expression",
"imageio_expr : equality_expression",
"imageio_expr : imageio_expr SHL equality_expression",
"imageio_expr : imageio_expr SHR equality_expression",
"assignment_expression : imageio_expr",
"assignment_expression : unary_expression ASSIGN assignment_expression",
"assignment_expression_opt : assignment_expression",
"assignment_expression_opt :",
"declaration : type_specifier init_declarator_list ';'",
"init_declarator_list : init_declarator",
"init_declarator_list : init_declarator_list ',' init_declarator",
"init_declarator : declarator",
"init_declarator : declarator '(' argument_list ')'",
"init_declarator : declarator '(' ')'",
"init_declarator : declarator ASSIGN initializer",
"argument_list : assignment_expression",
"argument_list : argument_list ',' assignment_expression",
"declarator : IDENT",
"declarator : '(' declarator ')'",
"type_specifier : TYPE_INT",
"type_specifier : TYPE_FLOAT",
"type_specifier : TYPE_MATRIX",
"type_specifier : TYPE_IMAGE",
"type_specifier : TYPE_HISTOGRAM",
"type_specifier : TYPE_STRING",
"type_specifier : TYPE_HANDLE",
"type_specifier : TYPE_VOID",
"initializer : assignment_expression",
"initializer : matrix_expression",
"matrix_expression : '(' matrix_expression ')'",
"matrix_expression : '{' matrix_row_list '}'",
"matrix_row_list : matrix_row",
"matrix_row_list : matrix_row_list ',' matrix_row",
"matrix_row : '{' matrix_element_list '}'",
"matrix_element_list : assignment_expression",
"matrix_element_list : matrix_element_list ',' assignment_expression",
"statement : expression_statement",
"statement : compound_statement",
"statement : selection_statement",
"statement : iteration_statement",
"statement : jump_statement",
"expression_statement : assignment_expression ';'",
"expression_statement : ';'",
"compound_statement : '{' declaration_or_statement_list '}'",
"compound_statement : '{' '}'",
"declaration_or_statement_list : declaration",
"declaration_or_statement_list : statement",
"declaration_or_statement_list : declaration_or_statement_list statement",
"declaration_or_statement_list : declaration_or_statement_list declaration",
"selection_statement : IF '(' assignment_expression ')' statement if_statement",
"if_statement : ELSE statement",
"if_statement :",
"iteration_statement : WHILE '(' assignment_expression ')' '{' statement '}'",
"iteration_statement : FOR '(' identifier_list ')' '@' '[' range_list ']' '{' statement '}'",
"identifier_list : IDENT",
"identifier_list : identifier_list ',' IDENT",
"range_list : range",
"range_list : range_list ',' range",
"range : assignment_expression ':' assignment_expression",
"jump_statement : BREAK ';'",
"jump_statement : CONTINUE ';'",
"jump_statement : RETURN ';'",
"jump_statement : RETURN assignment_expression ';'",
"func_block : FUNCSYM '{' function_definition_list '}'",
"function_definition_list : function_definition",
"function_definition_list : function_definition_list function_definition",
"prog_block : PROGSYM compound_statement",
"function_definition : type_specifier function_declarator compound_statement",
"function_declarator : IDENT '(' parameter_list ')'",
"function_declarator : IDENT '(' ')'",
"parameter_list : parameter_declaration",
"parameter_list : parameter_list ',' parameter_declaration",
"parameter_declaration : type_specifier IDENT",
};

//#line 302 "cvbpl.y"

	private SymbolTable st = new SymbolTable();

  private Yylex lexer;


  private int yylex () {
    int yyl_return = -1;
    try {
      yylval = new ParserVal(0);
      yyl_return = lexer.yylex();
    }
    catch (IOException e) {
      System.err.println("IO error :"+e);
    }
    return yyl_return;
  }


  public void yyerror (String error) {
    System.err.println ("Error: " + error);
  }


  public Parser(Reader r) {
    lexer = new Yylex(r, this);
  }


  static boolean interactive;

  public static void main(String args[]) throws IOException {
    System.out.println("CVBPL");

    Parser yyparser;
    if ( args.length > 0 ) {
      // parse a file
      yyparser = new Parser(new FileReader(args[0]));
    }
    else {
      // interactive mode
      System.out.println("[Quit with CTRL-D]");
      System.out.print("Expression: ");
      interactive = true;
	    yyparser = new Parser(new InputStreamReader(System.in));
    }

    yyparser.yyparse();
    
    if (interactive) {
      System.out.println();
      System.out.println("Exiting");
    }
  }
//#line 613 "Parser.java"
//###############################################################
// method: yylexdebug : check lexer state
//###############################################################
void yylexdebug(int state,int ch)
{
String s=null;
  if (ch < 0) ch=0;
  if (ch <= YYMAXTOKEN) //check index bounds
     s = yyname[ch];    //now get it
  if (s==null)
    s = "illegal-symbol";
  debug("state "+state+", reading "+ch+" ("+s+")");
}





//The following are now global, to aid in error reporting
int yyn;       //next next thing to do
int yym;       //
int yystate;   //current parsing state from state table
String yys;    //current token string


//###############################################################
// method: yyparse : parse input and execute indicated items
//###############################################################
int yyparse()
{
boolean doaction;
  init_stacks();
  yynerrs = 0;
  yyerrflag = 0;
  yychar = -1;          //impossible char forces a read
  yystate=0;            //initial state
  state_push(yystate);  //save it
  val_push(yylval);     //save empty value
  while (true) //until parsing is done, either correctly, or w/error
    {
    doaction=true;
    if (yydebug) debug("loop"); 
    //#### NEXT ACTION (from reduction table)
    for (yyn=yydefred[yystate];yyn==0;yyn=yydefred[yystate])
      {
      if (yydebug) debug("yyn:"+yyn+"  state:"+yystate+"  yychar:"+yychar);
      if (yychar < 0)      //we want a char?
        {
        yychar = yylex();  //get next token
        if (yydebug) debug(" next yychar:"+yychar);
        //#### ERROR CHECK ####
        if (yychar < 0)    //it it didn't work/error
          {
          yychar = 0;      //change it to default string (no -1!)
          if (yydebug)
            yylexdebug(yystate,yychar);
          }
        }//yychar<0
      yyn = yysindex[yystate];  //get amount to shift by (shift index)
      if ((yyn != 0) && (yyn += yychar) >= 0 &&
          yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
        {
        if (yydebug)
          debug("state "+yystate+", shifting to state "+yytable[yyn]);
        //#### NEXT STATE ####
        yystate = yytable[yyn];//we are in a new state
        state_push(yystate);   //save it
        val_push(yylval);      //push our lval as the input for next rule
        yychar = -1;           //since we have 'eaten' a token, say we need another
        if (yyerrflag > 0)     //have we recovered an error?
           --yyerrflag;        //give ourselves credit
        doaction=false;        //but don't process yet
        break;   //quit the yyn=0 loop
        }

    yyn = yyrindex[yystate];  //reduce
    if ((yyn !=0 ) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
      {   //we reduced!
      if (yydebug) debug("reduce");
      yyn = yytable[yyn];
      doaction=true; //get ready to execute
      break;         //drop down to actions
      }
    else //ERROR RECOVERY
      {
      if (yyerrflag==0)
        {
        yyerror("syntax error");
        yynerrs++;
        }
      if (yyerrflag < 3) //low error count?
        {
        yyerrflag = 3;
        while (true)   //do until break
          {
          if (stateptr<0)   //check for under & overflow here
            {
            yyerror("stack underflow. aborting...");  //note lower case 's'
            return 1;
            }
          yyn = yysindex[state_peek(0)];
          if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
            if (yydebug)
              debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
            yystate = yytable[yyn];
            state_push(yystate);
            val_push(yylval);
            doaction=false;
            break;
            }
          else
            {
            if (yydebug)
              debug("error recovery discarding state "+state_peek(0)+" ");
            if (stateptr<0)   //check for under & overflow here
              {
              yyerror("Stack underflow. aborting...");  //capital 'S'
              return 1;
              }
            state_pop();
            val_pop();
            }
          }
        }
      else            //discard this token
        {
        if (yychar == 0)
          return 1; //yyabort
        if (yydebug)
          {
          yys = null;
          if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
          if (yys == null) yys = "illegal-symbol";
          debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
          }
        yychar = -1;  //read another
        }
      }//end error recovery
    }//yyn=0 loop
    if (!doaction)   //any reason not to proceed?
      continue;      //skip action
    yym = yylen[yyn];          //get count of terminals on rhs
    if (yydebug)
      debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
    if (yym>0)                 //if count of rhs not 'nil'
      yyval = val_peek(yym-1); //get current semantic value
    yyval = dup_yyval(yyval); //duplicate yyval if ParserVal is used as semantic value
    switch(yyn)
      {
//########## USER-SUPPLIED ACTIONS ##########
case 1:
//#line 54 "cvbpl.y"
{ st.dump(); }
break;
case 2:
//#line 55 "cvbpl.y"
{ st.dump(); }
break;
case 43:
//#line 132 "cvbpl.y"
{
		String type = val_peek(2).sval;
		List<String> names = (List<String>) val_peek(1).obj;
		st.addVariables(type, names);
	}
break;
case 44:
//#line 140 "cvbpl.y"
{
		ArrayList<String> al = new ArrayList<String>();
		yyval.obj = al;
		al.add(val_peek(0).sval);}
break;
case 45:
//#line 144 "cvbpl.y"
{
		ArrayList<String> al = (ArrayList<String>)
		val_peek(2).obj;
		al.add(val_peek(0).sval);}
break;
case 102:
//#line 262 "cvbpl.y"
{
		Function func = (Function) val_peek(1).obj;
		func.setReturnType(val_peek(2).sval);
		yyval.obj = func;
		st.addFunction(func);
	}
break;
case 103:
//#line 272 "cvbpl.y"
{
		String name = val_peek(3).sval;
		ArrayList<String> paramList = (ArrayList<String>) val_peek(1).obj;
		Function func = new Function(name, paramList);
		yyval.obj = func;}
break;
case 104:
//#line 277 "cvbpl.y"
{
		String name = val_peek(2).sval;
		ArrayList<String> al = new ArrayList<String>();
		Function func = new Function(name, al);
		yyval.obj = func;}
break;
case 105:
//#line 285 "cvbpl.y"
{
		ArrayList<String> al = new ArrayList<String>();
		yyval.obj = al;
		al.add(val_peek(0).sval);}
break;
case 106:
//#line 289 "cvbpl.y"
{
		ArrayList<String> al = (ArrayList<String>) val_peek(2).obj;
		al.add(val_peek(0).sval);}
break;
//#line 830 "Parser.java"
//########## END OF USER-SUPPLIED ACTIONS ##########
    }//switch
    //#### Now let's reduce... ####
    if (yydebug) debug("reduce");
    state_drop(yym);             //we just reduced yylen states
    yystate = state_peek(0);     //get new state
    val_drop(yym);               //corresponding value drop
    yym = yylhs[yyn];            //select next TERMINAL(on lhs)
    if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
      {
      if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
      yystate = YYFINAL;         //explicitly say we're done
      state_push(YYFINAL);       //and save it
      val_push(yyval);           //also save the semantic value of parsing
      if (yychar < 0)            //we want another character?
        {
        yychar = yylex();        //get next character
        if (yychar<0) yychar=0;  //clean, if necessary
        if (yydebug)
          yylexdebug(yystate,yychar);
        }
      if (yychar == 0)          //Good exit (if lex returns 0 ;-)
         break;                 //quit the loop--all DONE
      }//if yystate
    else                        //else not done yet
      {                         //get next state and push, for next yydefred[]
      yyn = yygindex[yym];      //find out where to go
      if ((yyn != 0) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn]; //get new state
      else
        yystate = yydgoto[yym]; //else go to new defred
      if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
      state_push(yystate);     //going again, so push state & val...
      val_push(yyval);         //for next action
      }
    }//main loop
  return 0;//yyaccept!!
}
//## end of method parse() ######################################



//## run() --- for Thread #######################################
/**
 * A default run method, used for operating this parser
 * object in the background.  It is intended for extending Thread
 * or implementing Runnable.  Turn off with -Jnorun .
 */
public void run()
{
  yyparse();
}
//## end of method run() ########################################



//## Constructors ###############################################
/**
 * Default constructor.  Turn off with -Jnoconstruct .

 */
public Parser()
{
  //nothing to do
}


/**
 * Create a parser, setting the debug to true or false.
 * @param debugMe true for debugging, false for no debug.
 */
public Parser(boolean debugMe)
{
  yydebug=debugMe;
}
//###############################################################



}
//################### END OF CLASS ##############################
